/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.header h1 {
    font-size: 2.5em;
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 700;
}

.header p {
    font-size: 1.1em;
    color: #7f8c8d;
    font-weight: 400;
}

/* 主要内容区域 */
.main-content {
    display: flex;
    gap: 30px;
    flex: 1;
}

/* 左侧控制面板 */
.control-panel {
    width: 350px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    height: fit-content;
}

.panel-section {
    margin-bottom: 30px;
}

.panel-section h3 {
    font-size: 1.3em;
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}

/* 文件上传区域 */
.upload-section {
    margin-bottom: 20px;
}

.upload-area {
    border: 2px dashed #bdc3c7;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.upload-area:hover {
    border-color: #3498db;
    background: #e3f2fd;
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: #2ecc71;
    background: #e8f5e8;
}

.upload-area.uploaded {
    border-color: #27ae60;
    background: #d5f4e6;
}

.upload-icon {
    font-size: 2em;
    margin-bottom: 10px;
}

.upload-text strong {
    display: block;
    color: #2c3e50;
    margin-bottom: 5px;
    font-size: 1.1em;
}

.upload-text span {
    color: #7f8c8d;
    font-size: 0.9em;
}

.file-status {
    margin-top: 8px;
    font-size: 0.9em;
    color: #7f8c8d;
    text-align: center;
}

.file-status.uploaded {
    color: #27ae60;
    font-weight: 600;
}

/* 处理按钮 */
.process-button {
    width: 100%;
    padding: 15px;
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.process-button:hover:not(:disabled) {
    background: linear-gradient(45deg, #2980b9, #1f5f8b);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.process-button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 导出选项控制面板 */
.export-section {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.export-section h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1em;
    border-bottom: 2px solid #27ae60;
    padding-bottom: 5px;
}

.export-options {
    margin-bottom: 20px;
}

.option-group {
    margin-bottom: 15px;
}

.option-group label {
    display: block;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 5px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: #2c3e50;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    background: white;
    border: 2px solid #27ae60;
    border-radius: 4px;
    margin-right: 10px;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: #27ae60;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.format-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
    font-size: 0.9em;
    color: #2c3e50;
}

.format-select:focus {
    outline: none;
    border-color: #27ae60;
    box-shadow: 0 0 5px rgba(39, 174, 96, 0.3);
}

.filename-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9em;
    color: #2c3e50;
}

.filename-input:focus {
    outline: none;
    border-color: #27ae60;
    box-shadow: 0 0 5px rgba(39, 174, 96, 0.3);
}

.option-help {
    font-size: 0.8em;
    color: #7f8c8d;
    margin-top: 5px;
    font-style: italic;
}

/* 导出按钮 */
.export-button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(45deg, #27ae60, #229954);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.export-button:hover:not(:disabled) {
    background: linear-gradient(45deg, #229954, #1e8449);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.4);
}

.export-button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.export-icon {
    font-size: 1.2em;
}

/* 可视化控制 */
.view-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.view-btn {
    padding: 12px 20px;
    border: 2px solid #3498db;
    background: white;
    color: #3498db;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.view-btn:hover {
    background: #3498db;
    color: white;
    transform: translateY(-1px);
}

.view-btn.active {
    background: #3498db;
    color: white;
    box-shadow: 0 3px 10px rgba(52, 152, 219, 0.3);
}

/* 渲染设置 */
.render-settings {
    margin-top: 20px;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    gap: 10px;
}

.setting-item label {
    font-weight: 500;
    color: #2c3e50;
    min-width: 60px;
}

.setting-item input[type="range"] {
    flex: 1;
    margin: 0 10px;
}

.setting-item span {
    min-width: 40px;
    text-align: right;
    font-weight: 600;
    color: #3498db;
}

/* 状态显示 */
.status-display {
    margin-bottom: 15px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.status-label {
    font-weight: 500;
    color: #2c3e50;
}

.status-value {
    font-weight: 600;
    color: #3498db;
}

/* 进度条 */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #ecf0f1;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    width: 0%;
    transition: width 0.3s ease;
}

/* 右侧可视化区域 */
.visualization-area {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    position: relative;
}

.render-container {
    width: 100%;
    height: 600px;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    background: #1a1a1a;
}

.three-container {
    width: 100%;
    height: 100%;
    position: relative;
}

/* 加载覆盖层 */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #3498db;
    border-top: 4px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-text {
    color: white;
    font-size: 1.1em;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 图像容器 */
.image-container {
    width: 100%;
    height: 600px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8f9fa;
    border-radius: 10px;
    position: relative;
}

.image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.image-info {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 0.9em;
}

/* 3D导航控制面板 */
.navigation-controls {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-section:last-child {
    margin-bottom: 0;
}

.nav-section h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1em;
    border-bottom: 2px solid #3498db;
    padding-bottom: 5px;
}

.preset-views {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 15px;
}

.nav-btn {
    padding: 8px 12px;
    border: 1px solid #3498db;
    background: white;
    color: #3498db;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9em;
    font-weight: 500;
}

.nav-btn:hover {
    background: #3498db;
    color: white;
    transform: translateY(-1px);
}

.nav-btn.active {
    background: #3498db;
    color: white;
    box-shadow: 0 2px 5px rgba(52, 152, 219, 0.3);
}

.reset-btn {
    grid-column: span 2;
    background: #e74c3c !important;
    border-color: #e74c3c !important;
    color: white !important;
}

.reset-btn:hover {
    background: #c0392b !important;
    border-color: #c0392b !important;
}

.controls-help {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.help-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
}

.help-icon {
    font-size: 1.2em;
    width: 25px;
    text-align: center;
}

.help-text {
    font-size: 0.9em;
    color: #7f8c8d;
}

/* 下方三列布局 */
.bottom-panels {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.bottom-panel {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    border: 1px solid #e9ecef;
}

.bottom-panel h4 {
    color: #2c3e50;
    margin-bottom: 12px;
    font-size: 1em;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
    font-weight: 600;
}

/* 导出选项面板 */
.export-options-compact {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toggle-label-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-weight: 500;
    color: #2c3e50;
}

.label-compact {
    display: block;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 4px;
    font-size: 0.9em;
}

.format-select, .filename-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85em;
    margin-bottom: 4px;
}

.export-button-compact {
    width: 100%;
    padding: 8px;
    background: linear-gradient(45deg, #27ae60, #229954);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.export-button-compact:hover:not(:disabled) {
    background: linear-gradient(45deg, #229954, #1e8449);
    transform: translateY(-1px);
}

.export-button-compact:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

/* 可视化控制面板 */
.view-controls-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.view-btn-bottom {
    padding: 8px 10px;
    border: 1px solid #ddd;
    background: white;
    color: #2c3e50;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.85em;
}

.view-btn-bottom:hover {
    background: #f0f7ff;
    border-color: #3498db;
    color: #3498db;
}

.view-btn-bottom.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.render-settings-compact {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.slider-container input[type="range"] {
    flex: 1;
}

.slider-container span {
    min-width: 30px;
    text-align: right;
    font-weight: 600;
    color: #3498db;
    font-size: 0.85em;
}

/* 处理状态面板 */
.status-display-bottom {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.status-item-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    background: white;
    border-radius: 4px;
    border-left: 3px solid #3498db;
    font-size: 0.85em;
}

.status-label-bottom {
    font-weight: 500;
    color: #555;
}

.status-value-bottom {
    font-weight: 700;
    color: #3498db;
}


/* Toggle 开关样式 */
.toggle-container {
    margin-bottom: 8px;
}

.toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 8px;
}

.toggle-text {
    font-size: 1em;
    line-height: 1.2;
}

.toggle-switch {
    position: relative;
    display: inline-block;
}

.toggle-switch input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    background-color: #ccc;
    border-radius: 24px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #27ae60;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.2);
}

.toggle-status {
    font-size: 0.85em;
    color: #6c757d;
    line-height: 1.3;
    transition: all 0.3s ease;
    padding: 6px 12px;
    background: #e8f5e8;
    border-radius: 4px;
    margin-top: 8px;
}

.toggle-status.inactive {
    background: #f1f3f4;
    color: #6c757d;
}

/* 底部 */
.footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.footer p {
    color: #7f8c8d;
    font-size: 0.9em;
}

/* 模态对话框 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 15% auto;
    padding: 0;
    border-radius: 15px;
    width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: #e74c3c;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #bdc3c7;
}

.modal-body {
    padding: 20px 25px;
}

.modal-footer {
    padding: 15px 25px;
    text-align: right;
    border-top: 1px solid #ecf0f1;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

.success-modal .modal-content {
    border-left: 5px solid #27ae60;
}

.success-header {
    background: #d5f4e6;
    color: #27ae60;
}

.success-header h3 {
    color: #27ae60;
    margin: 0;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
    }

    .control-panel {
        width: 100%;
    }

    .view-controls {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .view-btn {
        flex: 1;
        min-width: 120px;
    }

    .preset-views {
        grid-template-columns: repeat(3, 1fr);
    }

    .reset-btn {
        grid-column: span 3;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header h1 {
        font-size: 2em;
    }

    .render-container {
        height: 400px;
    }

    .render-info {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .preset-views {
        grid-template-columns: repeat(2, 1fr);
    }

    .reset-btn {
        grid-column: span 2;
    }

    .controls-help {
        display: none; /* 在小屏幕上隐藏详细说明 */
    }

    .nav-section h4 {
        font-size: 1em;
    }
}
